/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package umlapp.elements;

import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import umlapp.diagrams.Elements;
import umlapp.elements.members.Attribute;
import umlapp.elements.members.Operation;
import umlapp.icons.ImageLoader;

/**
 *
 * Trieda reprezentujúca elementy typu actor.
 *
 * @author Peter Chovanec
 * @author Mario Jaros
 */
public class ActorElement extends AElement implements Elements {

    /**
     * Konštruktor s dvoma parametrami
     *
     * @param name meno na nastavenie atribútu
     * @param dimension dimension na nastavenie atribútu
     */
    public ActorElement(String name, Dimension dimension) {
        super(name, dimension);
    }

    /**
     * Konštruktor s viacerými parametrami
     *
     * @param name paremeter meno
     * @param dimension parameter dimension
     * @param attributes parameter list atribútov
     * @param operations parameter list operácii
     */
    public ActorElement(String name, Dimension dimension, ArrayList<Attribute> attributes,
            ArrayList<Operation> operations) {
        super(name, dimension);
        this.dimension.width = 39;
        this.dimension.height = 51;
    }

    /**
     * Vykreslenie celého elementu
     *
     * @param g
     */
    @Override
    public void drawElement(Graphics g) {
        this.dimension.width = 39;
        this.dimension.height = 60;
        g.drawImage(ImageLoader.actor, dimension.x, dimension.y, null);
        drawName(g);
    }

    /**
     * pomocna metóda na vykreslenie mena elementu
     *
     * @param g
     */
    public void drawName(Graphics g) {
        int x = (dimension.x + (dimension.width / 2)) - (7 * (name.length() / 2));
        int y = dimension.y + 58;
        g.setColor(Color.BLACK);
        g.drawString(name, x, y);
    }
}
